/*
 * @Author: sunkai@xinxinapp.cn
 * @Date: 2021-05-27 16:30:03
 * @LastEditTime: 2021-05-27 17:12:45
 * @LastEditors: sunkai@xinxinapp.cn
 * @Description: 
 * @FilePath: /adangular/src/app/app.component.ts
 */
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CartService } from './cart.services'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.less']
})
export class AppComponent {
  title = 'adangular';

  items = this.cartService.getItems()
  constructor (private route: ActivatedRoute, private cartService: CartService) {

  }

  addToCart (product: any) {
    this.cartService.addToCart(product)
  }

  delCart (name: string) {
    this.cartService.delCart(name)
  }

}
